declare sub addnick (nick as string)
declare sub delnick (nick as string)
declare function IsAllowed (nick as string) as integer
	
sub delnick (nick as string)
	
	open "authority.txt" for input as 10
	open "temp.txt" for output as 11
	
	dim tempnick as string
	
	while not eof(10)
		line input #10, tempnick
		
		if tempnick <> lcase(nick) then print #11, tempnick
	wend
	
	close #10
	close #11
#ifdef __FB_WIN32__
	shell ("del authority.txt")
	shell ("rename temp.txt authority.txt")
#endif

#ifdef __FB_LINUX__
    shell ("rm authority.txt")
	shell ("mv temp.txt authority.txt")
#endif

end sub


function IsAllowed (nick as string) as integer
	
	dim tempnick as string
	dim found as integer
	open "authority.txt" for input as 12
	
	seek #12,1
	
	while not eof (12)
		line input #12, tempnick
		if lcase(tempnick) = lcase(nick) then found= -1
	wend
	

	close 12

	return found

end function


sub addnick (nick as string)
	
	open "authority.txt" for append as 13
	if not isAllowed(nick) then print #13, lcase(nick)
	close 13
end sub
